<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:t="http://www.pagac.cz/jsf">
 <h:head></h:head>
 <h:body>
    <ui:composition template="/WEB-INF/templates/template-insystem.xhtml">

        <!-- Toolbar -->
        <ui:define name="toolbar-place">
            <t:toolbar>
                <t:icon iconName="home" action="goHome" label="#{msgs['toolbar.home']}" />
                <t:icon iconName="back" action="invoice/list" label="#{msgs['toolbar.back']}" />
                <t:icon iconName="print" action="printPage" label="#{msgs['toolbar.print']}" />
            </t:toolbar>
        </ui:define>

       <ui:define name="content-title">
           <h1>#{msgs["invoice.create.page-title"]}</h1>
       </ui:define>

        <ui:define name="content">
            <c:if test="#{invoiceManager.newInvoice}" />
            <div>
                <br />
                <fieldset>
                <legend>#{msgs["invoice.customerProject"]}</legend>
                <h:panelGrid columns="2">
                    <h:outputLabel for="customer">#{msgs["invoice.create.customer"]}</h:outputLabel>
                    <h:selectOneMenu id="customer" required="true" value="#{invoiceManager.customerId}">
                        <f:selectItem itemValue="0" itemLabel="#{msgs['invoice.create.selectCustomer']}" />
                        <f:selectItems value="#{customerManager.selectList}" />
                        <f:ajax execute="@this" event="valueChange"  render="project" onevent="showIndicator" />
                    </h:selectOneMenu>


                    <h:outputLabel for="project">#{msgs["invoice.create.project"]}</h:outputLabel>
                    <h:selectOneMenu id="project" required="true" value="#{invoiceManager.projectId}">
                        <f:selectItem itemValue="0" itemLabel="#{msgs['invoice.create.selectProject']}" />
                        <f:selectItems value="#{invoiceManager.selectProjectsList}" />
                        <f:ajax execute="@this" event="valueChange" render="addressPanel"  onevent="showIndicator" />
                    </h:selectOneMenu>
                </h:panelGrid>
                </fieldset>
                <br />
                    <fieldset>
                        <legend>#{msgs["invoice.customerValues"]}</legend>
                            <h:panelGrid id="addressPanel" columns="2">
                                <h:outputLabel>#{msgs["invoice.create.customer.name"]}</h:outputLabel>
                                <h:outputLabel>#{invoiceManager.customer.name}</h:outputLabel>
                                <h:outputLabel>#{msgs["invoice.create.customer.address"]}</h:outputLabel>
                                <h:outputLabel>#{invoiceManager.customer.address}</h:outputLabel>
                                <h:outputLabel>#{msgs["invoice.create.customer.city"]}</h:outputLabel>
                                <h:outputLabel>#{invoiceManager.customer.city}</h:outputLabel>
                                <h:outputLabel>#{msgs["invoice.create.customer.zipCode"]}</h:outputLabel>
                                <h:outputLabel>#{invoiceManager.customer.zipCode}</h:outputLabel>
                                <h:outputLabel>#{msgs["invoice.create.customer.email"]}</h:outputLabel>
                                <h:outputLabel>#{invoiceManager.customer.email}</h:outputLabel>
                            </h:panelGrid>
                    </fieldset>


                    <br />
                    <h:commandButton action="#{invoiceManager.create}" type="submit" value="#{msgs['invoice.createSubmit']}"></h:commandButton>


                </div>
            

       </ui:define>
    </ui:composition>

</h:body>
</html>
